.fragment-attachments
  - attachments.each do |attachment|
    :ruby
      thumb_url = if attachment.variable?
        url_for(attachment.variant(combine_options: Comfy::Cms::File::VARIANT_SIZE[:thumb]))
      end
      filename = attachment.filename.to_s
      truncated_filename = truncate(filename, length: 40, omission: "...#{filename.last(10)}")

      link_data = {
        cms_file_thumb_url: thumb_url,
        cms_file_link_tag: cms_page_file_link_tag(
          fragment_id:  fragment_id,
          attachment:   attachment,
          multiple:     multiple
        )
      }

    .fragment-attachment.btn-group.btn-group-sm.mb-1
      = link_to truncated_filename, attachment, data: link_data, class: "btn btn-light text-truncate", target: "_blank"
      = check_box_tag "#{object_name}[fragments_attributes][#{index}][file_ids_destroy][]", attachment.id, false, id: dom_id(attachment)
      %label.btn.btn-light{for: dom_id(attachment)}
        %i.fas.fa-fw.fa-times
